<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" placeholder="员工姓名" id="name_input">
<input type="text" placeholder="员工工资" id="salse_input"><br>
<input type="text" placeholder="员工工作" id="job_input">
<input type="button" value="添加" onclick="f()">
<table border="1">
  <caption>员工列表</caption>
  <tr>
    <th>姓名</th>
    <th>工资</th>
    <th>工作</th>
  </tr>
</table>
<script>
  //得到页面中三个文本框和表格
  let nameInput=document.querySelector("#name_input")
  let salseInput=document.querySelector("#salse_input")
  let jobInput=document.querySelector("#job_input")
  let table=document.querySelector("table")
  function f() {
    //创建tr和3个td
    let tr=document.createElement("tr");
    let nameTd=document.createElement("td");
    let salseTd=document.createElement("td");
    let jobTd=document.createElement("td");
    //设置td显示的文本内容
    nameTd.innerText=nameInput.value;
    salseTd.innerText=salseInput.value;
    jobTd.innerText=jobInput.value;
    //把td装进tr里面
    tr.append(nameTd,salseTd,jobTd);
    //将tr装进table里面
    table.append(tr)
  }
</script>
</body>
</html>